var oAllTop = document.getElementById("all-top");
var aAllTop = oAllTop.getElementsByClassName("all-top-a");
for(var i=0; i<aAllTop.length; i++) {
    aAllTop[i].value=i;
    aAllTop[i].onclick =function() {
        for(var j=0; j<aAllTop.length; j++) {
            aAllTop[j].className="all-top-a";
        }
        aAllTop[this.value].className="all-top-a all-top-selected";
    }
}